<template>
<!-- max不知道什么时候拿到，所以用watch来监听 -->
    <div class="mui-numbox" data-numbox-min="1" :data-numbox-max='max' >
					<button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
          <!-- 新属性 值改变的时候用@change调用方法 -->
					<input id="test" class="mui-input-numbox" type="number" value="1" @change="countchanged" ref="numbox">
					<button class="mui-btn mui-btn-numbox-plus" type="button" disabled="">+</button>
				</div>
</template>

<script>
import mui from "../../lib/dist/js/mui.min.js";

export default {
  data() {
    return {
      newmax:''
    };
  },
  mounted() {
    //初始化选择框组件
    mui(".mui-numbox").numbox();
  },

  // watch: {
  //   max: function(newvue, oldvue) {
  //     mui(Selector)
  //       .numbox()
  //       .setOption("max",newvue );
  //   }
  // },
  watch: {
    max(newvue, oldvue) {
      mui(".mui-numbox")
        .numbox()
        .setOption("max",newvue );
    }
  },

 
  props: ["max"],
  methods: {
    countchanged() {
      this.$emit("getnumcount", parseInt(this.$refs.numbox.value));
    }
  }
};
</script>

<style>
</style>


